import {legacy_createStore as createStore} from "redux"
import homereducer from "./homereducer"
import thunk from "redux-thunk"
import logger from "redux-logger"
// applyMiddleware 是处理中间件的
import {combineReducers,applyMiddleware} from "redux" // 用于合并抽离出去之后的reducer的
// reducer state action dispatch
// reducer 就是一个函数，要将这个函数传递给创建仓库的方法
// let initstate = {
//     name:"张三"
// }
// let reducer = (state = initstate ,action)=>{
//     // redux 不能直接修改原来的数据
//     let newState = JSON.parse(JSON.stringify(state))
//     return newState

// }
let reducer = combineReducers({
    homereducer
})
export default createStore(reducer,applyMiddleware(thunk,logger))
